package CTRLayer;
import ModelLayer.Customer;
import DBLayer.DBCustomer;

public class CustomerCTR 
{
	private DBCustomer dbCustomer;
	public CustomerCTR()
	{
		dbCustomer = new DBCustomer();
	}
	
	public Customer createCustomer(String name, String ssn, String phoneno, String email, String address, String zipCode)
	{
		Customer customer = new Customer(name, ssn, phoneno, email, address, zipCode);
		return customer;
	}
	
	public void insertCustomer(String name, String ssn, String phoneno, String email, String address, String zipCode)
	{
		Customer customer = createCustomer(name, ssn, phoneno, email, address, zipCode);
		dbCustomer.insertCustomer(customer);
	}
	
	public Customer getCustomer(String phoneno, boolean retrieveAssociations)
	{
		Customer customer = dbCustomer.findCustomer(phoneno, retrieveAssociations);
		return customer;
	}
	
	public void updateCustomer(String phoneno, String newName, String newSsn, String newPhoneno, String newEmail, String newAddress, String newZipCode)
	{
		Customer customer = createCustomer(newName, newSsn, newPhoneno, newEmail, newAddress, newZipCode);
		dbCustomer.updateCustomer(customer, phoneno);
	}
	
	public void deleteCustomer(String phoneno)
	{
		dbCustomer.removeCustomer(phoneno);
	}
}
